

function mainboard()
{
	/*var usr=
	{
		theme:'',
	};
	*/
	var canopen=false;
	this.init=function(uid)
	{
		_createbox(uid);
		_bind();
		
		_getallmsg(uid);
	}
	function _createbox(uid)
	{
		clear_effect();
		//$("#mainboard").remove();
		//$("#spt_mainboard").remove();

		//设置用户初始在线状态
		var scode=usr.getpro(uid.toString(),'status');
		//console.log(scode);
		var k=_getstatus_string(uid,scode);
		
		$("body").append(
		'<div class="mainboard owner_'+uid+'" id="mainboard_'+uid+'">'+
		'<div class="mainboardcolor theme_bgimg_'+uid+'"></div>'+
		'<div class="mainboardglass">'+
		'<div class="mb_top"></div>'+
		'<div class="mb_cen"></div>'+
		'<div class="mb_foo"></div>'+
		'</div>'+
		'<div class="mainboardcontent">'+
			'<div class="mainheadbox">'+
				'<div id="mainbar">'+
					'<img src="img/mainpanel/qqlogoCover.png"/>'+
					'<div class="mainclose" id="mainclose_'+uid+'" title="关闭"></div>'+
					'<div class="maintiny" id="maintiny_'+uid+'" title="最小化"></div>'+
					'<div class="accprt" title="账号宝未开启，开启后账号防盗能力提升10倍"><img src="img/mainpanel/qqpcmgr/AccProt_disable.png"/></div>'+
					'<div class="vipico" title="有未领取的勋章，领取后QQ聊天更安全快捷"></div>'+
					'<div class="clear"></div>'+
				'</div>'+
				'<div id="mainhead">'+
				'<table class="mainheadframe">'+
				'<tr>'+
				'<td class="mh">'+
				'<div class="myhead" title="个人资料完整度27%，完善个人资料">'+
				'<div class="img mainboard_openintrocard"><img id="mainboard_openintrocard_'+uid+'" class="user_imghead100" src="'+usr.getuser(uid).img100+'"/></div>'+
				'<!--右击头像设置选择框-->'+
				'<ul class="mainhead_setboard">'+
				'<li class="editmyintro"><a href="javascript:;" onClick="editmyintro('+uid+')">修改个人资料</a></li>'+
				'<li class="changehead"><a href="javascript:;" onClick="changehead('+uid+')">更换头像</a></li>'+
				'<li class="syssetting"><a href="javascript:;" onClick="syssetting('+uid+')">系统设置</a></li>'+
				'</ul>'+
				'</div>'+
				'</td>'+
				'<td class="mi">'+
				'<div class="myinfo">'+
					'<div class="info">'+
					'<div class="myname username_all">'+usr.getuser(uid).name+'</div>'+
					'<div class="mystatus" scode="'+scode+'" title="'+k.status_intro+'"><img class="statusselect_img" src="'+k.iname+'"/><img src="img/mainpanel/MainPanel_FolderNode_expandTextureHighlight.png"/></div>'+
					'<div class="mylv">'+
						'<div class="mylvbox" title="我的Q等级&#10 等级:1级&#10 剩余升级天数:6天">'+
						'<div class="lvimg"><img src="img/mainpanel/lv.png"/></div>'+
						'<div class="lvnum"><img id="lvnumimg" src="img/mainpanel/levelvalue.png"/></div>'+
						'</div>'+
					'</div>'+
					/*'<div class="mysign usersign_all">'+usr.getuser(uid).sign+'</div>'+*/
					'<input type="text" class="mysign usersign_all" value="'+usr.getuser(uid).sign+'" title="点击修改签名"/>'+
				'</div>'+
				'<div class="mytools">'+
					'<img src="img/VasBizIcon/16.png"/>'+
					'<img src="img/VasBizIcon/TencentNet.png"/>'+
					'<img src="img/VasBizIcon/34/icon.png"/>'+
					'<img src="img/VasBizIcon/35/icon.png"/>'+
					'<img src="img/VasBizIcon/244/icon.png"/>'+
					'<img src="img/VasBizIcon/185/icon.png"/>'+

					'<img src="img/mainpanel/all_arrow_out.png" class="allow_out"/>'+

					'<img src="img/VasBizIcon/116/icon.png"/>'+
					'<img src="img/VasBizIcon/84/icon.png"/>'+
					'<img src="img/VasBizIcon/42/icon.png"/>'+
					'<img src="img/VasBizIcon/8/0.png"/>'+
					'<img src="img/VasBizIcon/27/icon.png"/>'+
				'</div>'+
				'</div>'+
				'</td>'+
				'<td class="wtm">'+
					'<div class="weatherico"><img src="img/sun_48.png"/></div>'+
					'<div class="them_msg">'+
					'<div class="them_btn" title="更改外观"></div>'+
					'<div class="msgbox_btn" title="打开消息盒子"></div>'+
					'</div>'+
				'</td>'+
				'</tr>'+
				'</table>'+
				'</div>'+
				'<div class="mainsearchbar" title="输入QQ号码，姓名/昵称，拼音，Email查找&#10联系人,还可以通过完整的QQ号码查找陌生&#10人">'+
				'<div class="masbar">'+
				'<div class="searchtips">搜索&nbsp;:&nbsp;联系人,&nbsp;&nbsp;讨论组,&nbsp;&nbsp;群,&nbsp;&nbsp;企业</div>'+
				'<img src="img/mainpanel/search_icon.png"/>	'+
				'<div class="clear"></div>'+
				'</div>'+
				'<div class="searchshadow"></div>'+
			'</div>'+
		'</div>	'+	

		'<div class="mainfriend" id="mainfriend_'+uid+'">'+
			'<div class="frdpage" id="frdpage_'+uid+'">'+
			'<div class="icopage">'+
			'<div class="pagetab pageico_last" title="会话">'+
			'<div class="pagetabcnt down" id="">'+
			'<div class="tabimg"></div>'+
			'<div class="more"></div>'+
			'</div></div>'+
			'<div class="pagetab pageico_contacts" title="联系人">'+
			'<div class="pagetabcnt normal">'+
			'<div class="tabimg"></div>'+
			'<div class="more"></div>'+
			'</div></div>'+
			'<div class="pagetab pageico_group" title="群/讨论组">'+
			'<div class="pagetabcnt normal">'+
			'<div class="tabimg"></div>'+
			'<div class="more"></div>'+
			'</div></div>'+
			'<div class="pagetab pageico_zone" title="QQ空间-特别关心">'+
			'<div class="pagetabcnt normal">'+
			'<div class="tabimg"></div>'+
			'</div></div>'+
			'<div class="pagetab pageico_tclass" title="腾讯课堂">'+
			'<div class="pagetabcnt normal">'+
			'<div class="tabimg"></div>'+		
			'</div></div>'+
			'<div class="pagetab pageico_phone" title="我的手机">'+
			'<div class="pagetabcnt normal">'+
			'<div class="tabimg"></div>'+
			'</div></div></div><div class="icopagebg"></div></div>'+

			'<div class="ico_contacts pagectrl" id="ico_contacts_'+uid+'"><div class="contacts_cnt"><div class="contacts_page"></div></div></div>'+
			'<div id="ico_last_'+uid+'" class="ico_last pagectrl"><div class="lastcnt"><div class="last_page"></div></div></div>'+
			'<div id="ico_group_'+uid+'" class="ico_group pagectrl">'+
				'<div class="grptalkpage">'+
				'<div class="mygrptalk">QQ群</div>'+
				'<div class="mydiscus">讨论组</div>'+
				'<div class="grpliveroom">直播间</div>'+
				'<div class="grpweb"><img src="img/mainpanel/home.png"/></div>'+
				'<div class="creategrpbtn">创建<img src="img/mainpanel/MainPanel_FolderNode_expandTextureHighlight.png"/></div>'+
				'<div class="clear"></div>'+
				'</div>	'+
						
				'<div id="page_grptalk">'+
				'<div class="grptalksub">'+
				'<div class="grptalkhead">'+
				'<div class="grptalk_putdown"><img src="img/mainpanel/0.png"/></div>'+
				'<div class="subgroupname">我的QQ群</div>'+
				'<div class="subgroupsum">25</div>'+
				'<div class="clear"></div>'+
				'</div></div></div>'+

				'<div id="page_discus">'+
				'<div class="discussub">'+
				'<div class="discushead">'+
				'<div class="discus_putdown"><img src="img/mainpanel/0.png"/></div>'+
				'<div class="subdiscusname">讨论组</div>'+
				'<div class="subdiscussum">7</div>'+
				'<div class="clear"></div>'+
				'</div></div></div><!--page_discus-->'+
				'<div id="page_liveroom"></div></div>'+
			
			'</div>'+
			'<div class="maintools">'+
				'<div class="mainapp">'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1022/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1002/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1004/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1005/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1003/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/10004/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1021/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1007/16.png"/></div>'+
					'<div id="" class="appico"><img src="img/mainpanel/appcenter/AppIcon/1008/16.png"/></div>'+
					'<div id="appmarket_btn" title="打开应用管理器"></div>'+
				'</div>'+
				'<div class="mainset">'+
					'<div class="main_menu set1" title="主菜单"></div>'+
					'<div class="main_setting set2" title="打开系统设置"></div>'+
					'<div class="main_msgmgr set3" title="打开消息管理器"></div>'+
					'<div class="main_filemgr set4" title="打开文件助手"></div>'+
					'<div class="main_collection set5" title="打开我的收藏"></div>'+
					'<div class="main_find set6" title="找人,找群,找服务">查找</div>'+
					'<div class="appbox" title="打开应用宝"><div class="appboximg"></div>应用宝</div>'+
				'</div>'+
			'</div>'+
		'</div>'+

		'<!--在线状态及工具快速设置盒子-->'+
		'<div class="statusbox">'+
		'<ul class="statuslist">'+
		'<li class="on_1" scode="1" title="表示希望好友看到您在线&#10;声音:开启&#10;消息提示框:开启&#10;会话消息:任务栏头像闪动"><img src="img/status/flag/big/imonline.png"/>我在线上</li>'+
		'<li class="on_2" scode="2" title="表示希望好友主动联系您&#10;声音:开启&#10;消息提示框:开启&#10;会话消息:自动弹出会话窗口"><img src="img/status/flag/big/Qme.png"/>Q我吧</li>'+
		'<li class="le_1" scode="3" title="表示离开，暂时无法处理消息&#10;声音:开启&#10;消息提示框:开启&#10;会话消息:任务栏头像闪动"><img src="img/status/flag/big/away.png"/>离开</li>'+
		'<li class="le_2" scode="4" title="表示忙碌，无法处理消息&#10;声音:开启&#10;消息提示框:开启&#10;会话消息:任务栏显示气泡"><img src="img/status/flag/big/busy.png"/>忙碌</li>'+
		'<li class="le_3" scode="5" title="表示不想被打扰&#10;声音:关闭&#10;消息提示框:关闭&#10;会话消息:任务栏显示气泡"><img src="img/status/flag/big/mute.png"/>请勿打扰</li>'+
		'<li class="tr_1" scode="6" title="表示好友看到您是离线的&#10;声音:开启&#10;消息提示框:开启&#10;会话消息:任务栏头像闪动"><img src="img/status/flag/big/invisible.png"/>隐身</li>'+
		'<li class="of_1" scode="0" title="断开与服务器的连接"><img src="img/status/flag/big/imoffline.png"/>离线</li>'+
		'<li class="addstatus">添加状态信息</li>'+
		'</ul>'+
		'<ul class="mute">'+
		'<li class="closeallsound">关闭所有声音</li>'+
		'<li class="closeheadflash">关闭头像闪动</li>'+
		'</ul>'+
		'<ul class="lock">'+
		'<li class="lockqq"><img src="img/status/flag/big/invisible.png"/>锁定QQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl+Alt+L</li>'+
		'</ul>'+
		'<ul class="tools">'+
		'<li class="setting">系统设置...</li>'+
		'<li class="myinfo">我的资料...</li>'+
		'<li class="myqqcenter">我的QQ中心</li>'+
		'</ul>'+
		'</div>'+


	'</div>'	
		);
		
		$('.statusboxout').remove();
		$('.statusnew').remove();

		$("#mainboard_"+uid).slideDown();
		$("#qqnew").html('<img id="qqicoimg_'+uid+'" src="'+k.ico_iname+'"/>');
		//此处判断用户登陆状态再设置title
		var title="QQ:"+usr.getuser(uid).name+"("+usr.getuser(uid).account+")\n"+k.ico_intro;

		$("#qqnew").attr("title",title);

		$("#qqnew").attr("id","qqico_"+uid);
		//console.log('user login->');
		//console.log(usr.getuser(uid));
	}
	function clear_effect()
	{

	}
	function _bind()
	{
		
		//界面被点击时更新当前界面id
		$(".mainboard").click(function()
		{
			//current.id=parseInt($(this).attr("id").replace("mainboard_",""));
			//设置当前界面
			//current.frame=$(this).attr("id");
			
			//隐藏无关界面
			$(this).find('.statusbox').css('display','none');
			$(this).find('.mainhead_setboard').css('display','none');


			//当前界面置顶
			toper.set($(this).attr("id"));

		}).dblclick(function()
		{
			//设置当前界面置顶
			toper.set($(this).attr("id"));
		});

		//添加拖拽
		drag($(".mainboard"));
		//drag($(".mainboard"),"status",function(id,x,y,maxX,maxY)
		//{
			/*var w=id[0].clientWidth-5,h=id[0].clientHeight-5;
			if(x==maxX&&y>0)
			{
				//id.css('left', '-'+w+'px');
				//id.attr('drag','false');
				id.mouseover(function()
				{
					id.css('left', '0');
					id.attr('drag','true');
				}).mouseout(function()
				{
					if(id.css("left")==0)
					{
						id.css('left', '-'+w+'px');
						id.attr('drag','false');
					}
				});
			}
			else if(x<maxX&&y==0)
			{
				//id.css('top', '-'+h+'px');
				//id.attr('drag','false');
				id.mouseover(function()
				{
					id.css('top', '0');
					id.attr('drag','true');
				}).mouseout(function()
				{
					if(id.css("top")==0)
					{
						id.css('top', '-'+h+'px');
						id.attr('drag','false');
					}
				});
			}
			*/
		//});

		$(".mainclose").click(function()
		{
			
			var id=$(this).attr("id").replace("mainclose_","");
			
			//在网页上停止轮询脚本的下次运行
			msgcenter.stop(id);
			
			/*
			//关掉所有本用户的对话框
			var frds=usr.getother(id,'frd');
			var grps=usr.getother(id,'grp');
			var dises=usr.getother(id,'dis');
			_closeframe(id,frds,'frd');			
			_closeframe(id,grps,'grp');
			_closeframe(id,dises,'dis');
			*/

			$('.owner_'+id).remove();
			
			//移除用户数组
			usr.removeuser(id);
			//发送离线状态，使轮询脚本停止运行
			$.ajax({
				type:'POST',
				data:'u='+id+'&&us=0',//获取所有在线用户的消息
				url:'action/setstatus.php',
				success:function(msg)
				{
					if(msg=='ok')
					{
						console.log('发送离线状态成功');
					}
					else
					{
						console.log('发送离线状态失败');
					}
				}
			});


			//移除状态栏图标
			$("#qqico_"+id).remove();
			
			//关闭主面板
			$("#mainboard_"+id).slideUp("normal",function()
			{
				//移除本框
				$(this).remove();
				/*
				if($(".mainboard").length<=0)
				{
					$("#mainboard_js").remove();
				}
				*/
			});
			//console.log(usr.getinfo());

			clear_effect();

		});

		/*
		var _closeframe=function(uid,arr,type)
		{
			//console.log(arr);
			if(arr!=false||arr!=undefined)
			{
				for(var i=0;i<arr.length;i++)
				{
					var fid=arr[i].frdid||arr[i].id;
					//console.log("#chatframe_"+friends[i]+"_"+id+","+$("#chatframe_"+friends[i]+"_"+id).length);
					if($("#chatframe_"+type+fid+"_"+uid).length>0)
					{
						$("#chatframe_"+type+fid+"_"+uid).remove();
					}
					if($("#bar_"+type+fid+"_"+uid).length>0)
					{
						$("#bar_"+type+fid+"_"+uid).remove();
					}
					
				}
			}
		}
		*/
		//最小化
		$(".maintiny").click(function()
		{
			var id=$(this).attr("id").replace("maintiny_","");
			$("#mainboard_"+id).hide("fast");
		});

		//开启资料卡面板按钮
		$('.mainboard_openintrocard').click(function(e)
		{
			var uid=$(this).parents(".mainboard").attr("id").replace("mainboard_","");
			if($('#userintrocard_self_'+uid).length>0)
			{
				$('#userintrocard_self_'+uid).css('display','block').trigger('click');
				return false;
			}
			else
			{
				/*
				if($("#userintrocard_js").length<=0)
				{
					$('body').append('<script id="userintrocard_js" type="text/javascript" src="js/userintrocard.js"></script>');
				}
				*/
				new UserIntroCard().init(uid,'self');
			}

			e.stopPropagation();
		});



		//设置按钮
		$(".main_setting").click(function(e)
		{
			var uid=$(this).parents(".mainboard").attr("id").replace("mainboard_","");
			if($("#setting_board_"+uid).length>0)
			{
				//toper.set("#setting_board_"+uid);
				return;
			}
			/*
			if($("#setting_boardjs").length<=0)
			{
				$('body').append('<script id="setting_boardjs" type="text/javascript" src="js/setting_board.js"></script>');
			}
			*/
			new setting_board().init(uid);
			e.stopPropagation();
		});
		
		//消息盒子
		$('.msgbox_btn').click(function(e)
		{
			var uid=$(this).parents(".mainboard").attr("id").replace("mainboard_","");
			/*
			if($("#msglib_js").length<=0)
			{
				$('body').append('<script id="msglib_js" type="text/javascript" src="js/msglib.js"></script>');
			}
			*/
			new MsgLib().init(uid);
			e.stopPropagation();
		});
		//打开主题盒子
		$('.them_btn').click(function(e)
		{
			var uid=$(this).parents(".mainboard").attr("id").replace("mainboard_","");
			/*
			if($("#themebox_js").length<=0)
			{
				$('body').append('<script id="themebox_js" type="text/javascript" src="js/themebox.js"></script>');
			}
			*/
			new ThemeBox().init(uid);
			e.stopPropagation();
		});
		//打开查找面板
		$('.main_find').click(function(e)
		{
			var uid=$(this).parents(".mainboard").attr("id").replace("mainboard_","");
			/*
			if($("#find_boardjs").length<=0)
			{
				$('body').append('<script id="find_boardjs" type="text/javascript" src="js/findboard.js"></script>');
			}
			*/

			new Findboard().init(uid);
			e.stopPropagation();
		});

		//设置好友列表滚动页
		$('.ico_contacts').mouseover(function()
		{
			Scroll.set($(this),$(this).find('.contacts_cnt'),$(this).find('.contacts_page'));
		});

		$('.ico_last').mouseover(function()
		{
			Scroll.set($(this),$(this).find('.lastcnt'),$(this).find('.last_page'));
		});










		//设置状态或其他
		$('.mystatus').click(function(e)
		{
			$(this).parents('.mainboard').find('.statusbox').css('display','block').css('z-index','10000');
			e.stopPropagation();
		});

		//选择状态面板
		$('.statusbox').click(function(e)
		{
			var li=$(e.target);
			var cs=li.attr('class');
			//console.log(cs);
			if(cs=='closeallsound')
			{
				/*
				打开工具功能：
				创建面板或直接修改设置
				*/
			}
			else if(cs=='closeheadflash')
			{
			}
			else if(cs=='addstatus')
			{
			}
			else if(cs=='lockqq')
			{
			}
			else if(cs=='myinfo')
			{
			}
			else if(cs=='myqqcenter')
			{
			}
			else
			{
				/*
					状态设置:
					设置到主面板中(mystatus 中标记statuscode 表示正在的状态)
					
					提交到服务器更新后，设置到底部QQ图标中
				*/
				var uid=$(this).parents('.mainboard').attr('id').replace('mainboard_','');
				var sb=$(this).parents('.mainboard').find('.mystatus');
				var sc=parseInt(sb.attr('scode'));
				var scode=parseInt(li.attr('scode'));
				var img=sb.find('.statusselect_img');
				if(sc==scode)//如果状态码相等，则不用设置直接返回
				{
					return;
				}
				
						//方法位于loginbox底部中
				var k=_getstatus_string(uid,scode);


				//设置全局状态
				usr.setpro(uid,'status',scode);

				//如果是设置离线状态，则停止轮询
				if(scode==0)
				{
					msgcenter.stop(uid);
				}

				//如果之前是离线状态，则需要重新开启轮询
				if(sc==0&&scode>0)
				{
					//msgcenter.restart(uid);
					_openchunk(uid);
				}
				//console.log('scode='+scode);
				//发送更新状态
				$.ajax({
					url:'action/setstatus.php',
					data:'u='+uid+'&&us='+scode,
					type:'POST',
					success:function(msg)
					{
						//console.log('scode='+scode+'设置成功后='+msg);
						//console.log(usr.getpro(uid,'status'));
						if(msg=='ok')
						{
							console.log('scode='+scode+'设置成功');
							if(scode==0)
							{
								console.log('设置离线状态成功');
							}
				
							//设置用户界面变化
							sb.attr('title',k.status_intro).attr('scode',scode);
							img.attr('src',k.iname);
							$('#qqico_'+uid).attr('title',k.ico_intro);
							$('#qqicoimg_'+uid).attr('src',k.ico_iname);
							
							//更改到cookie以方便下次登录时直接选择(离线除外)
							if(scode>0)
							{
								var status='';
								switch(scode)
								{
									case 1:
										status="on_1";
										break;
									case 2:
										status="on_2";
										break;
									case 3:
										status="le_1";
										break;
									case 4:
										status="le_2";
										break;
									case 5:
										status="le_3";
										break;
									case 6:
										status="tr_1";
										break;
									default:
										status="on_1";
								}
								var acclist=Cookie.get('acclist');
								//var add='id_'+logmsg.id+','+account+','+logmsg.name+','+logmsg.img+','+status+','+isautolog+','+(isrempwd==1?pwd:'')+'|';
								eval("var pat=/(id_"+uid+",[^,]*,[^,]*,[^,]*,)[^,]*(,)/m");
								Cookie.set('acclist',acclist.replace(pat,'$1'+status+'$2'),365);
								//console.log(Cookie.get('acclist'));

								//console.log(usr.checkall());
							}
						}
						else
						{
							//弹出提示框
							console.log('修改状态失败，状态码'+scode);
						}
						return;
					},
					error:function()
					{
						//弹出提示框
						console.log('修改状态因网络问题失败');
					}
				
				});
				
			}
		
			
			$(this).css('display','none');
			e.stopImmediatePropagation();
			return;
		});
		
		//签名修改
		$('.mainboard .mysign').change(function(e)
		{
			var uid=$(this).parents('.mainboard').attr('id').replace('mainboard_','');
			var str=$.trim($(this).val());
			_ajaxget('type=setsign&&needid='+uid+'&&str='+str,'get_userinfos',function(m)
			{
				if(m=='ok')
				{
					usr.setpro(uid,'sign',str);
					$('.owner_'+uid+' .usersign_all').html(str).val(str);
					console.log('修改签名成功');
				}
				else
				{
					console.log('修改签名失败');
				}

			});
			
			e.stopImmediatePropagation();
		});


		


	}//初始绑定结束
	

	

	//打开轮询
	function _openchunk(id)
	{
		msgcenter.openchunk(id);
		/*
		msgcenter.openchunk(id,function(msg)
		{
			var uid=id;
			if(usr.getuser(uid)==false)
			{
				return false;
			}

			if(msg&&msg!='false')
			{
				for (var i=0;i<msg.length;i++)
				{
					var st=parseInt(msg[i].status);
					var fid=msg[i].fid;
					//console.log("user="+uid+" fid="+fid+" status="+st);

					var fd=$("#ico_contacts_"+uid+" div[name='frd_"+fid+"']");
					var lastfd=$("#ico_last_"+uid+" div[name='lastfds_"+fid+"']");
					
					//设置离线状态
					if(st==0||st==6)
					{
						//console.log('离线');
						if(fd.attr("class").indexOf("fds_offline")>=0)
						{
							//console.log('已经设置过离线，返回');
							//如果之前已经是离线，则直接返回
							continue;
						}
						//console.log('准备设置离线');
						var limg=usr.getaother(uid).leftimg;
						
						fd.find("imagehead>img").attr("src",limg);
						fd.find(".frdnew").html("[离线请留言]");
						//更改离线线class
						var fdclass=fd.attr("class");
						fdclass=fdclass.replace("fds_online","fds_offline");
						fd.attr("class",fdclass);
						//console.log('离线class');
						//移动到最低处
						var gid=fd.parents(".groups").attr("id");
						fd.insertAfter("#ico_contacts_"+uid+" #"+gid+" .fds:last");
						//console.log("#ico_contacts_"+uid+" #"+gid+" .fds:last");
						if($("#chatframe_frd"+fid+"_"+uid).length>0)
						{
							//console.log('离线设置对话框');
							$("#chatframe_frd"+fid+"_"+uid).find(".imghead>img").attr("src",limg);
							
							bottombar.setimg("frd"+fid,uid,limg);
							//console.log('离线对话框设置完毕');
						}
						if(lastfd.length>0)
						{
							//console.log('离线设置最近好友');
							lastfd.find(".imagehead>img").attr("src",limg);
							//更改离线class
							var lastfdclass=lastfd.attr("class").replace("lastfds_online","lastfds_offline");
							lastfd.attr("class",lastfdclass);
							//console.log('离线设置最近好友完毕');
						}
						
					}
					else 
					{
						//console.log('在线');
						var imagehead=' frd';
						if(st==1||st==2)
						{
							imagehead='';
						}
						else if(st==3)
						{
							imagehead+='away';
						}
						else if(st==4)
						{
							imagehead+='busy';
						}
						else if(st==5)
						{
							imagehead+='mute';
						}
						fd.find(".frdolflag").attr("class","frdolflag"+imagehead);
						//console.log('准备设置在线');
						//如果该好友之前是离线，则设置各种在线参数
						if(fd.attr("class").indexOf("fds_offline")>=0)
						{
							//console.log('如果是离线，设置回在线状态');
							//console.log(usr.getaother(uid,fid).sign);
							//fd.find("imagehead>img").attr("src",usr.getaother(uid,fid).img);
							fd.find(".frdnew").html(usr.getaother(uid,fid).sign);
							var fdclass=fd.attr("class").replace("fds_offline","fds_online");
							fd.attr("class",fdclass);
							//移动到最高处
							var gid=fd.parents(".groups").attr("id");
							lastfd.insertBefore("#ico_last_"+uid+" .lastfds:first");
							fd.insertAfter("#ico_contacts_"+uid+" #"+gid+" .fds:first");
							
							//设置上线提示音
							$('#gotaglobal')[0].play();
							//console.log('在线设置完毕');
						}

						if($("#chatframe_frd"+fid+"_"+uid).length>0)
						{
							$("#chatframe_frd"+fid+"_"+uid+" .frdolflag").attr("class","frdolflag"+imagehead);
							//console.log('在线设置对话框');
						}
						if(lastfd.length>0)
						{
							lastfd.find(".frdolflag").attr("class","frdolflag"+imagehead);
							//console.log('在线设置最近好友');
						}
					}

				}
				
			}
		});*/
	}

	function _getallmsg(id)
	{
		//console.log(usrall[i].id);
			var o=
			{
				data:"acc="+ACC.code+"&&u="+id,
				url:'action/init_mainboard.php',
				dataType:'json',
				type:'POST',
				success:function(msg)
				{
					//usr.set("id",id,"theme",msg['theme']);
					usr.setpro(id,'theme',msg['theme']);
					usr.setpro(id,'frdgrp',msg['gps']);
					for(var i=0;i<msg['frdlist'].length;i++)
					{
						//fd.set(msg['frdlist'][i],id);
						usr.addother(id,msg['frdlist'][i]);
					}
					usr.setpro(id,'lastcnt',msg['laststr']);

					setTheme(msg['theme'],id);
					setpagefrd(msg['gps'],msg['frdlist'],msg['last'],id);
					
					setmsg(msg['msg_all'],id);
					/*
					setpagegrp(msg['groups']);
					setpagelast(msg['last']);
					
					*/
						
					bind();
					_openchunk(id);
					
					
				},
			};
			$.ajax(o);







		//获取主题背景，用户自定义设置
		/*
		用户主题表
		uid 拥有此设置的用户id
		istheme 是否官方主题 1
		themeid 官方主题id   1
		isshow 是否想好友展示自己的主题 1
		（以下为自定义，使用官方主题则不读取以下内容）
		mainx 主面板宽度 286
		mainy 主面板高度 513
		bg 主面板背景    
		headop 主面板头部透明度 1
		cntop 主面板内容透明度  1
		*/


		//获取好友分组，好友
		
		

		//获取群，讨论组





		//获取最近联系人
		/*
		lastcontact表 (此表可以考虑放到cookie中)
		uid 拥有此列的用户id
		contact 最近联系的用户

		通过获取最近联系的用户后，获取所有最近联系好友的好友名，图片
		*/
		//获取所有未读消息
		/*
		显示所有信息提示到最新联系列表中，并根据顺序排列最近联系人，更新最近联系人的最后读取信息和时间
		并显示提示到状态栏闪烁和好友列表闪烁，消息盒子提示
		*/
			

		//获取天气


		//开启轮询

		//开启获取好友在线状态
	}
	//设置主题
	function setTheme(theme,id)
	{
		if(theme!=false)
		{
			//设置背景
			$("#mainboard_"+id+">.mainboardcolor").css('background',theme['bgcolor']);
			theme['bgimg'].length>0?$("#mainboard_"+id+">.mainboardcolor").css('background','url('+theme['bgimg']+')'+(theme['bgrepeat']==0?'no-repeat':'repeat')).css('background-size','cover'):'';
			//设置整体透明度（根据是否开启毛玻璃效果）
			theme['openglass']==1?$("#mainboard_"+id+" .mainboardcolor").css("filter","alpha(opacity="+theme['skinopacity']+")").css("-moz-opacity",(theme['skinopacity']/100)).css("opacity",(theme['skinopacity']/100)):'';
			//设置整体颜色覆盖度
			$("#mainboard_"+id+" .mainboardglass").css("filter","alpha(opacity="+theme['glassopacity']+")").css("-moz-opacity",(theme['glassopacity']/100)).css("opacity",(theme['glassopacity']/100));
			//设置宽高
			$("#mainboard_"+id).css("width",theme['width']+"px").css("height",theme['height']+"px");
			//$("#mainboard_"+id+">.mainboardglass>.mb_cen").css("height",(theme['mainy']-201)+"px");
		}
	}

	//获取好友分组，好友
	function setpagefrd(gps,frd,last,id)
	{
		$("#ico_contacts_"+id+' .contacts_page').html("");
		$("#ico_contacts_"+id+' .contacts_page').append(
		'<div class="groups" id="frdgrp_phone_'+id+'">'+
		'<div class="grphead">'+
		'<div class="grp_putdown"><img src="img/mainpanel/0.png"/></div>'+
		'<div class="grpname">我的设备</div>'+
		'<div class="frdsum">0/1</div>'+
		'<div class="clear"></div></div>'+
		'<div class="frdcontent">'+
		'<div class="fds normal" name="frd_phone">'+
		'<div class="imagehead"><img src="img/mainpanel/Default40.png"/></div>'+
		'<div class="frdmore"></div>'+
		'<div class="detail">'+
		'<div class="frdname">我的手机</div>'+
		'<div class="frdnew"></div></div></div></div></div>'+

		'<div class="groups" id="frdgrp_default_'+id+'">'+
		'<div class="grphead">'+
		'<div class="grp_putdown"><img src="img/mainpanel/0.png"/></div>'+
		'<div class="grpname">我的好友</div>'+
		'<div class="frdsum">0/0</div>'+
		'<div class="clear"></div></div>'+
		'<div class="frdcontent">'+
		'<div class="fds normal" name="frd_me">'+
		'<div class="imagehead"><img class="user_imghead60" src="'+usr.getuser(id).img+'"/></div>'+
		'<div class="frdmore"></div>'+
		'<div class="detail">'+
		'<div class="frdname">'+usr.getuser(id).name+'</div>'+
		'<div class="frdnew">'+usr.getuser(id).sign+'</div></div></div></div></div>'
			
		
		);
		
		//
		for(var i=0;i<gps.length;i++)
		{
			$("#ico_contacts_"+id+' .contacts_page').append(
			"<div class='groups' id='frdgrp_"+gps[i].id+"'>"+
			"<div class='grphead'><div class='grp_putdown'><img src='img/mainpanel/0.png'/></div><div class='grpname'>"+
			gps[i].gname+"</div><div class='frdsum'>0/"+gps[i].frdcount+"</div><div class='clear'></div></div><div class='frdcontent' id='frdcontent_"+gps[i].id+"'></div></div>"
			);
		}

		for(var i=0;i<frd.length;i++)
		{
			
			var html="<div class='fds normal fds_online' name='frd_"+frd[i].frdid+"'>";
			html+="<div class='imagehead'><img src='"+frd[i].img+"'/><div class='frdolflag'></div></div>";
			html+="<div class='frdmore'></div><div class='detail'>";
			if(frd[i].frdname=="")
			{
				html+="<div class='frdname'>"+frd[i].name+"</div>";
			}
			else
			{
				html+="<div class='frdname'>"+frd[i].frdname+"</div>";
			}
			html+="<div class='frdnew'>"+frd[i].sign+"</div></div></div>";
			if(parseInt(frd[i].gid)==0)
			{
				$("#frdgrp_default_"+id+" >.frdcontent").append(html);
			}
			else
			{
				$("#ico_contacts_"+id+" .contacts_page>#frdgrp_"+frd[i].gid+" > .frdcontent").append(html);
			}
		}
		
		
		var lasthtml='';
		//last=last.split(';');
		//console.log('last='+last);
		for(var i=0;i<last.length;i++)
		{
			var type=last[i].type;
			var img='';
			var time=last[i].time.length>0?getDateString(last[i].time,0):'';
			var lastname='';

			if(type=='frd')
			{
				var frd=usr.getaother(id,last[i].id);
				img=frd.img;
				lastname=frd.frdname.length>0?frd.frdname:frd.name;
			}
			else if(type=="validate")
			{
				img='img/VerifyMsg/SessionNode.png';
				lastname='验证消息';
			}

			lasthtml+=
			'<div class="lastfds" name="lastfds_'+type+'" lastid="'+type+'_'+last[i].id+'">'+
			'<div class="imagehead"><img src="'+img+'"/>'+(type=='frd'?'<div class="frdolflag"></div>':'')+'</div>'+	
			'<div class="lastmore">'+
			'<div class="lasttime">'+time+'</div>'+
			/*(parseInt(last[i].num)>0?'<div class="lastmsgnum">'+parseInt(last[i].num)+'</div>':'')+*/
			'</div>'+
			'<div class="detail"><div class="lastname">'+lastname+'</div>'+
			'<div class="lastmsg">'+last[i].laststr+'</div>'+
			'</div></div>';
		}
		$("#ico_last_"+id+" .lastcnt .last_page").html(lasthtml);
		

		/*
		$("#ico_last_"+id+" .lastcnt .last_page").append(

		'<div class="lastfds" name="lastfds_photo">'+
		'<div class="imagehead"><img src="img/mainpanel/RCBusinessNode/qphoto_node_head.png"/></div>'+	
		'<div class="lastmore">'+
		'<div class="lasttime">2015-7-8</div>'+
		'<div class="lastmsgnum">4</div></div>'+
		'<div class="detail"><div class="lastname">好友照片</div>'+
		'<div class="lastmsg">婉芝，石头等好友更新照片</div>'+
		'</div></div>'+
		
		'<div class="lastfds" name="lastfds_frdvalidate">'+
		'<div class="imagehead"><img src="img/VerifyMsg/SessionNode.png"/></div>'+	
		'<div class="lastmore">'+
		'<div class="lasttime">2015-7-8</div>'+
		'</div>'+
		'<div class="detail"><div class="lastname">验证消息</div>'+
		'<div class="lastmsg"></div>'+
		'</div></div>'+

		'<div class="lastfds" name="lastfds_zone">'+
		'<div class="imagehead"><img src="img/mainpanel/RCBusinessNode/qzone_node_head.png"/></div>'+	
		'<div class="lastmore">'+
		'<div class="lasttime">2015-7-8</div>'+
		'<div class="lastmsgnum">1</div></div>'+
		'<div class="detail"><div class="lastname">空间动态</div>'+
		'<div class="lastmsg">光立回复了你</div>'+
		'</div></div>'
		);
		*/

	}
	function setmsg(arr,uid)
	{
		msgcenter.allocation(arr,uid);
	}







	function bind()
	{
		/*$(".frdname").click(function(){
			//return false;
		});
		*/
		//翻页效果
		$(".pagetab").click(function()
		{
			var id=$(this).parent(".icopage").parent(".frdpage").attr("id").replace("frdpage_","");
			var ico=$(this).attr("class").replace("pagetab page","");
			if($("#"+ico+"_"+id).css("display")=="none")
			{
				for(var i=0;i<$("#mainfriend_"+id+">.pagectrl").length;i++)
				{
					if($("#mainfriend_"+id+">.pagectrl").eq(i).css("display")=="block")
					{
						$("#mainfriend_"+id+">.pagectrl").eq(i).hide('fast');
						
					}
				}
				$("#"+ico+"_"+id).slideDown('fast');
	
				for(var i=0;i<$("#frdpage_"+id+">.icopage>.pagetab").length;i++ )
				{
					$("#frdpage_"+id+">.icopage>.pagetab>.pagetabcnt").eq(i).attr("class","pagetabcnt normal");
				}
				
				$(this).find(".pagetabcnt").attr("class","pagetabcnt down");
				
			}
		});

		//点击显示我的好友
		/*
		此处加载多个mainboard后会多次触发事件，因此使用了阻止事件多次触发和冒泡2015/7/10想了一天
		*/
		$(".ico_contacts .grphead").click(function(e)
		{
			//var id=$(this).parent(".grphead").parent(".groups").parent(".ico_contacts").attr("id").replace("ico_contacts_","");
			if($(this).next(".frdcontent").css("display")=="block")
			{
				$(this).find(".grp_putdown").html('<img src="img/mainpanel/0.png"/>');
				$(this).next(".frdcontent").css("display","none");
				//console.log($(this).next(".frdcontent").css("display")+","+$(this).next(".frdcontent").length+","+$(this).parent(".groups").attr("id"));
				//阻止事件触发多次
				e.stopImmediatePropagation();
				return;	
			}
			else
			{
				
				$(this).find(".grp_putdown").html('<img src="img/mainpanel/90.png"/>');
				$(this).next(".frdcontent").css("display","block");
				//console.log($(this).next(".frdcontent").css("display")+"-------------->>"+$(this).next(".frdcontent").length+","+$(this).parent(".groups").attr("id"));
				//阻止事件触发多次
				e.stopImmediatePropagation();
				return;
			}
		});

		

		/*$(".grphead").click(function(e)
		{
			//找出好友分组id
			var frdgrp=$(this).parent(".groups").attr("id");
			var frdgrpid=frdgrp.replace("frdgrp_","");
			
			console.log("frdgrpid="+frdgrpid);
			//var id=current.id;
			//var id=$(this).parent(".grphead").parent(".groups").parent(".ico_contacts").attr("id").replace("ico_contacts_","");
			if($("#frdgrp_"+frdgrpid+" .frdcontent").css("display")=="none")
			{
				console.log($("#frdgrp_"+frdgrpid+" .frdcontent").css("display"));
				$("#frdgrp_"+frdgrpid+">.grphead>.grp_putdown").html('<img src="img/mainpanel/90.png"/>');
				$("#frdgrp_"+frdgrpid+">.frdcontent").css("display","block");
				console.log($("#frdgrp_"+frdgrpid+" .frdcontent").css("display"));
			}
			else
			{
				console.log($("#frdcontent_"+frdgrpid).css("display"));
				$("#frdgrp_"+frdgrpid+">.grphead>.grp_putdown").html('<img src="img/mainpanel/0.png"/>');
				$("#frdgrp_"+frdgrpid+">.frdcontent").css("display","none");
				console.log($("#frdgrp_"+frdgrpid+" .frdcontent").css("display"));
			}
			console.log($("#frdgrp_"+frdgrpid).length);
		});
		*/
		//绑定好友列表与最近联系好友列表事件
		_bindFdsClick();
		
		

	}







	function _startchunk()
	{
		//openchunk();
	}

}



//绑定好友列表与最近联系好友列表事件
function _bindFdsClick()
{
	//好友的单击和双击方法
	var got=null;
	$(".fds").bind('click',function(e)
	{
		var ts=$(this);
		clearTimeout(got);
		
		got=setTimeout(function(){	
			//ts.next(".fds").attr("class","fds normal");
			/*var frds=ts.parents(".groups").find(".fds");
			
			for(var i=0;i<frds.length;i++)
			{
				var cls=frds.eq(i).attr("class").replace('selected','normal');
				frds.eq(i).attr("class",cls);
			}
			*/
			ts.parents(".contacts_page").find('.selected').removeClass('selected').addClass('normal');
			var cls=ts.attr('class').replace('normal','selected');
			ts.attr("class",cls);
		},300);
		//阻止事件触发多次
			e.stopImmediatePropagation();
		
	//增加双击方法
	}).bind('dblclick',function(e)
	{	
		clearTimeout(got);
		var ts=$(this);
		var frds=ts.parents(".groups").find(".fds");
		for(var i=0;i<frds.length;i++)
		{
			var cls=frds.eq(i).attr("class").replace('selected','normal');
			frds.eq(i).attr("class",cls);
		}
		var cls=ts.attr('class').replace('normal','selected');
		_openchat(ts);
		//阻止事件触发多次
		e.stopImmediatePropagation();

	});

	//最近联系的单击和双击方法
	var lastfds=null;
	$(".lastfds").bind('click',function(e)
	{
		var ts=$(this);
		clearTimeout(lastfds);
		
		got=setTimeout(function(){
			if(ts.hasClass('selected')==false)
			{
				ts.siblings('.selected').removeClass('selected');
				ts.addClass('selected');
			}
			
		},300);
		//阻止事件触发多次
			e.stopImmediatePropagation();
		
		
	//增加双击方法
	}).bind('dblclick',function(e)
	{	
		clearTimeout(lastfds);
		var ts=$(this);
		_openchat(ts);
		//阻止事件触发多次
			e.stopImmediatePropagation();
	});
}




function _openchat(ts)
{
	var name=ts.attr("name").replace("frd_","").replace("lastfds_","");
	//console.log('name='+name);
	//判断点击的是工具还是好友
	if(name=="me")
	{
		alert("打开QQ空间");
	}
	else if(name=="phone")
	{
		alert("你还没手机登录");
	}
	else if(name=="zone")
	{
		alert("打开空间动态");
	}
	else if(name=="photo")
	{
		alert("打开好友照片");
	}
	else
	{
		var type=ts.attr("class");
		var uid=toper.id();

		//好友信息收集
		if(type.indexOf("fds normal")>=0||type.indexOf("fds selected")>=0)
		{
			var fid=ts.attr("name").replace("frd_","");
	
			
			//console.log(uid);
			//如果对话框已经打开
			if($("#chatframe_frd"+fid+"_"+uid).length>0)
			{
				//则置顶
				$("#chatframe_frd"+fid+"_"+uid).trigger('click');
				return false;
			}
			//ajax获取用户主题设置并加入frd对象
			setlast2main(uid,'frd',fid);
			//打开聊天框
			new chatframe().init(usr.getaother(uid,fid),uid,'frd');//打开后获取信息盒子中所有该对象的信息
			//var frdnick=usr.getaother(uid,fid).frdname==""?usr.getaother(uid,fid).name:usr.getaother(uid,fid).frdname;
			//bottombar.add('frd'+fid,uid,frdnick);
			

			
		}
		//最近联系好友信息收集
		else if(type.indexOf("lastfds")>=0)
		{
			var fid=ts.attr('lastid').replace('frd_','');
			if($("#chatframe_frd"+fid+"_"+uid).length>0)
			{
				//则置顶
				$("#chatframe_frd"+fid+"_"+uid).trigger('click');
				return false;
			}
			//ajax获取用户主题设置并加入frd对象
			setlast2main(uid,'frd',fid);
			//打开聊天框
			new chatframe().init(usr.getaother(uid,fid),uid,'frd');//打开后获取信息盒子中所有该对象的信息
		}
		//群信息收集
		else if(type.indexOf("grptalk")>=0)
		{
		}
		//讨论组信息收集
		else if(type.indexOf("discus")>=0)
		{
		}
		
		
	}

}

/*
	设置最近联系人(uid,type,senderid,isread,lastcnt,time)

	mode1 全填
	添加或更新一条最近联系人提醒信息

	mode2 填一半
	isread,lastcnt与time不填的话，则是将本条联系人提醒信息设为已读
	
*/
function setlast2main(uid,type,senderid,isread,lastcnt,time,self)
{
	//console.log(lastcnt);
	if(lastcnt!=undefined)
	{
		if(self==undefined||self==false)
		{
			var getimg=/\[img format=([^\]]+)\]([^\]^\[]+)\[\/img\]/gmi;
			var getlink=/\[link\]([^\]^\[]+)\[\/link\]/gmi;
			var bigimg=/\[img\]\[([^\]^\[]+)\]\[\/img\]/gmi;
			lastcnt=lastcnt.replace(getimg,"[图片]").replace(getlink,"[链接]$1").replace(bigimg,"[大图]");
		}
		else
		{
			var clear_a=/<a[^>]+href="[^>]+"[^>]*>([^<]+)<\/a>/gmi;
			lastcnt=lastcnt.replace(clear_a," $1 ");
			//匹配文字中的上的网址
			var reg_link=/(http:\/\/|https:\/\/|ftp:\/\/)?(www\.)?([\w+\.]+)(com|cn|org|net|tw|hk|gov|com\.cn|org\.cn|net\.cn)((\/[^<|^>|^\s|^\"|^\']*)*)/gmi;
			//匹配文字中的图片
			var reg_img=/<img[^>]+format="([^>"]+)"[^>]+name="([^>"]+)"[^>]+>/gmi;
			lastcnt=lastcnt.replace("&nbsp;"," ").replace(reg_img,"[图片]").replace(reg_link,"[链接]$1$2$3$4$5");
		}
	}
	usr.setlast(uid,type,senderid);
	var page=$("#ico_last_"+uid+" .lastcnt .last_page");
	
	var lastfrd=page.find('div[lastid="'+type+'_'+senderid+'"]');

	if(lastfrd.length>0)
	{
		(lastcnt!=undefined&&lastcnt.length>0)?lastfrd.find('.lastmsg').html(lastcnt):'';
		(time!=undefined&&time.length>0)?lastfrd.find('.lasttime').html(getDateString(time,0)):'';

		if(isread!=undefined&&isread==0)
		{
			var ln=lastfrd.find('.lastmsgnum');
			if(ln.length<=0)
			{
				lastfrd.find('.lastmore').append('<div class="lastmsgnum">1</div>');
			}
			else
			{
				ln.html(parseInt(ln.html())+1);
			}
		}
		else if(isread==undefined||isread==1)
		{
			lastfrd.find('.lastmsgnum').remove();
		}

		if(page.find('.lastfds').length>1&&page.find('.lastfds:first')!=lastfrd)
		{
			lastfrd.insertBefore(page.find('.lastfds:first'));
		}
	}
	else
	{
		if(time==undefined)
		{
			return false;
		}
		var img='';
		var time=getDateString(time,0);
		var lastname='';
		if(type=='frd')
		{
			var frd=usr.getaother(uid,senderid);
			img=frd.img;
			lastname=frd.frdname.length>0?frd.frdname:frd.name;
		}
		else if(type=="validate")
		{
			img='img/VerifyMsg/SessionNode.png';
			lastname='验证消息';
		}
		var lasthtml=
		'<div class="lastfds" name="lastfds_'+type+'" lastid="'+type+'_'+senderid+'">'+
		'<div class="imagehead"><img src="'+img+'"/>'+(type=='frd'?'<div class="frdolflag"></div>':'')+'</div>'+	
		'<div class="lastmore">'+
		'<div class="lasttime">'+time+'</div>'+
		(isread==1||isread==undefined?'':'<div class="lastmsgnum">1</div>')+
		'</div>'+
		'<div class="detail"><div class="lastname">'+lastname+'</div>'+
		'<div class="lastmsg">'+lastcnt+'</div>'+
		'</div></div>';


		if(page.find('.lastfds').length>0)
		{
			
			page.find('.lastfds:first').before(lasthtml);
		}
		else
		{
			page.append(lasthtml);
		}
	}


}


//右击头像显示的选择框
function openMainheadselectbox(t,ex,ey)
{
	$(t).parent('.mainboard_openintrocard').siblings('.mainhead_setboard').css('display','block').css('top',ey+'px').css('left',ex+'px');
}

function editmyintro(uid)
{
	/*
	if($("#userintrocard_js").length<=0)
	{
		$('body').append('<script id="userintrocard_js" type="text/javascript" src="js/userintrocard.js"></script>');
	}
	*/
	new UserIntroCard().init(uid,'self');
	//new UserIntroCard().init(3,1);
}

function changehead(uid)
{
	/*
	if($("#changeheadboard_js").length<=0)
	{
		$('body').append('<script id="changeheadboard_js" type="text/javascript" src="js/changeheadboard.js"></script>');
	}
	*/
	new ChangeheadBoard().init(uid);
}

function syssetting(uid)
{
	/*
	if($("#setting_boardjs").length<=0)
	{
		$('body').append('<script id="setting_boardjs" type="text/javascript" src="js/setting_board.js"></script>');
	}
	*/
	new setting_board().init(uid);
}